import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from "@/views/Home";
// import Login from "@/views/Login";
import JsUserOrderDao from "@/components/order/JsUserOrderDao";
import JsUserOrderGood from "@/components/order/JsUserOrderGood";
import JsUserOrderDetailed from "@/components/order/JsUserOrderDetailed";
import JsUserOrderDetails from "@/components/order/JsUserOrderDetails";
import LookTinyCircle from "@/components/vCircle/LookTinyCircle";
import TinyCircle from "@/components/vCircle/TinyCircle";
import CommentDetails from '@/components/vCircle/CommentDetails';
import CourseComment from '@/components/vCircle/CourseComment';
import CourseCommentDetails from '@/components/vCircle/CourseCommentDetails';
import CommentList from '@/components/comment/CommentList';
import UserComment from '@/components/comment/UserComment';
import PassComment from '@/components/comment/PassComment';
import DeleteComment from '@/components/comment/DeleteComment';
import VcircleStatisTics from '@/components/statistics/VcircleStatisTics';
import CourseCollection from '@/components/statis/CourseCollection';
import CourseNumberLikes from '@/components/statis/CourseNumberLikes';
import ProductLikeQuantity from '@/components/statis/ProductLikeQuantity';
import CourseSalesVolume from '@/components/statis/CourseSalesVolume';
import ProductCollection from '@/components/statis/ProductCollection';
import ProductSalesVolume from '@/components/statis/ProductSalesVolume';
import StatisticalChart from '@/components/statis/StatisticalChart';
import CouponList from "@/components/coupon/CouponList";
import humanResourceHome from "../components/home/humanResourceHome";
import operateHome from "../components/home/operateHome";
import teacherHome from "../components/home/teacherHome";
import JsProductlist from "../components/product/JsProductlist";
import AddJsProduct from "../components/product/AddJsProduct";
import JsProductLogs from "../components/product/JsProductLogs";
import JsProductExamine from "../components/product/JsProductExamine";
import Courselist from "../components/course/Courselist";
import AddCourse from "../components/course/AddCourse";
import CourseLogs from "../components/course/CourseLogs";
import CourseExamine from "../components/course/CourseExamine";
import checkCoupon from "@/components/coupon/checkCoupon";
import detailsCoupon from "@/components/coupon/detailsCoupon";
import addCoupon from "@/components/coupon/addCoupon";

Vue.use(VueRouter);

const routes = [
  {path:'/',redirect:'login'},
  {
    path: '/login',
    name: 'login',
    component: () => import( '../views/Login')
  },
  {
    path: '/home',  //首页模块
    name: 'home',
    component: Home,
    children: [
      // {path: '/数据库两个字段拼接生成', component:模块名称},
      //优惠券模块
      {path: '/coupon/list', component:CouponList},
      {path: '/coupon/add', component:addCoupon},
      {path: '/coupon/check', component:checkCoupon},
      {path: '/coupon/check/details', component:detailsCoupon},
      //首页模块
      {path: '/home/teacher', component:teacherHome}, //教师
      {path: '/home/operate', component:operateHome}, //运营
      {path: '/home/humanResource', component:humanResourceHome},//人事
      //商品模块
      {path: '/good/list', component:JsProductlist},//商品列表
      {path: '/good/add', component:AddJsProduct},//商品添加
      {path: '/good/logs', component:JsProductLogs},//商品日志
      {path: '/good/examine', component:JsProductExamine},//商品审核
      //课程模块
      {path: '/class/list', component:Courselist},//课程列表
      {path: '/class/add', component:AddCourse},//课程添加
      {path: '/class/logs', component:CourseLogs},//课程日志
      {path: '/class/examine', component:CourseExamine},//课程审核
      {path: '/class/comment', component:CourseComment},//课程评论
      {path: '/coursecommentdetails/:id', component:CourseCommentDetails,props:true}, //课程评论详情
      //微圈模块
      {path: '/vCircle/list', component:LookTinyCircle},
      {path: '/vCircle/add', component:TinyCircle},
      //订单模块
      {path: '/order/class', component:JsUserOrderDao},
      {path: '/order/good', component:JsUserOrderGood},
      {path: '/order/Detailed', component:JsUserOrderDetailed},
      {path: '/order/Details', component:JsUserOrderDetails},
      //评价模块
      {path: '/commentdetails/:id', component:CommentDetails,props:true},
      {path: '/comment/list',component:CommentList},
      {path: '/comment/user/:id',component:UserComment,props:true},//名称点击带参数过去的
      {path: '/comment/user/',component:UserComment},
      {path: '/comment/pass',component:PassComment},
      {path: '/comment/unpass',component:UserComment},
      {path: '/comment/del',component:DeleteComment},

      //统计模块
      {path: '/statistics/vCircle',component:VcircleStatisTics},
      {path: '/statistics/classCollection',component:CourseCollection}, //课程收藏
      {path: '/statistics/classApprove',component:CourseNumberLikes}, //课程点赞
      {path: '/statistics/classPay',component:CourseSalesVolume},//课程销售量
      {path: '/statistics/goodApprove',component:ProductLikeQuantity}, //商品点赞
      {path: '/statistics/goodCollection',component:ProductCollection}, //商品收藏
      {path: '/statistics/goodPay',component:ProductSalesVolume}, //商品销售量
      {path: '/statistics/humanResource',component:StatisticalChart},//统计图
    ]
  }
]

const router = new VueRouter({
  routes
})


const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}

export default router
